<?php


namespace app\admin\model;


class ServiceNoModel extends BaseModel
{
    protected $name='service_no';

//订单号   产品编号
    public static function get_sn(){
        $count =self::order('id DESC')->find();
        $time =date('Ym');
        if(date('Ym',$count['add_time'])==$time){
            $number =  $time.str_pad(substr($count['num'],15)+1, 6, '0', STR_PAD_LEFT);
        }else{
            $number = $time.str_pad(0+1, 6, '0', STR_PAD_LEFT);
        }
        return $number;
    }
}